<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tagInfo-edit" th:object="${tagInfo}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
              <input id="editInfo" name="editInfo" th:value="${editInfo}" type="hidden">
            <div class="form-group">	
                <label class="col-sm-3 control-label">标签名称：</label>
                <div class="col-sm-8">
                    <input id="tagQuence" name="tagQuence" th:field="*{tagQuence}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
           
            <div class="form-group">	
                <label class="col-sm-3 control-label">厂商名称：</label>
                <div class="col-sm-8">
                   <!--  <input id="companyName" name="companyName" th:field="*{companyName}" class="form-control" type="text"> -->
                   <input id="companyName" name="companyName" th:value="${@garden.selectGardenName(tagInfo.companyName)}" class="form-control" type="text" readonly="readonly">
                   

                </div>
            </div>
          
         
            <div class="form-group">	
                <label class="col-sm-3 control-label">溯源码：</label>
                <div class="col-sm-8">
                 
                  
                   <input id="productCode" name="productCode" th:field="*{productCode}" class="form-control" readonly="readonly"> 
                  
                </div>
            </div>
         
            <div class="form-group">	
                <label class="col-sm-3 control-label">产品名称：</label>
                <div class="col-sm-8">
                    <input id="productName" name="productName" th:field="*{productName}" class="form-control" type="text" readonly="readonly" >
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">原料来源：</label>
                <div class="col-sm-8">
                    <input id="materialSource" name="materialSource" th:field="*{materialSource}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">加工工艺：</label>
                <div class="col-sm-8">
                    <input id="processTech" name="processTech" th:value="${@dict.getLabel('gh_process_tech',tagInfo.processTech)}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">生产日期：</label>
                <div class="col-sm-8">
                  <input id="productDate" name="productDate" th:field="*{productDate}" class="form-control" type="text"  placeholder="例如：180101"  readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">批次号：</label>
                <div class="col-sm-8">
                    <input id="batchNo" name="batchNo" th:field="*{batchNo}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">产品等级：</label>
                <div class="col-sm-8">
                    <!-- <input id="productRank" name="productRank" th:field="*{productRank}" class="form-control" type="text"> -->
                    <input id="productRank" name="productRank"  th:value="${@dict.getLabel('gh_product_level',tagInfo.productRank)}" class="form-control" type="text" readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">保质期：</label>
                <div class="col-sm-8">
                    <input id="expiredDate" name="expiredDate" th:field="*{expiredDate}" class="form-control" type="text"  placeholder="例如：180101" readonly="readonly">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">产品质量认证编号：</label>
                <div class="col-sm-8">
                    <input id="productCertNum" name="productCertNum" th:field="*{productCertNum}" class="form-control" type="text"  readonly="readonly">
                </div>
            </div>
               <div class="form-group">	
                <label class="col-sm-3 control-label">更新时间：</label>
                <div class="col-sm-8">
                    <input id="updateTime" name="updateTime" th:field="*{updateTime}" class="form-control"  type="text" readonly="readonly">
                </div>
            </div>
          <!--   <div class="form-group">	
                <label class="col-sm-3 control-label">生产信息校验码：</label>
                <div class="col-sm-8">
                    <input id="proCheckCode" name="proCheckCode" th:field="*{proCheckCode}" class="form-control" type="text">
                </div>
            </div> -->
            <div class="form-group">	
                <label class="col-sm-3 control-label">经销商名称：</label>
                <div class="col-sm-8">
                    <input id="dealerName" name="dealerName" th:field="*{dealerName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">销售时间：</label>
                <div class="col-sm-8">
                    <input id="saleTime" name="saleTime" th:field="*{saleTime}" class="form-control" type="text"  placeholder="例如：180101">
                </div>
            </div>
     <!--        <div class="form-group">	
                <label class="col-sm-3 control-label">销售信息校验码：</label>
                <div class="col-sm-8">
                    <input id="saleCheckCode" name="saleCheckCode" th:field="*{saleCheckCode}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">镜像：</label>
                <div class="col-sm-8">
                    <input id="readCounter" name="readCounter" th:field="*{readCounter}" class="form-control" type="text">
                </div>
            </div> -->
           <!--  <div class="form-group">	
                <label class="col-sm-3 control-label">cmac：</label>
                <div class="col-sm-8">
                    <input id="cmac" name="cmac" th:field="*{cmac}" class="form-control" type="text">
                </div>
            </div> -->
         
            <div class="form-group">	
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input id="remarks" name="remarks" th:field="*{remarks}" class="form-control" type="text" >
                </div>
            </div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/tagInfo"
		$("#form-tagInfo-edit").validate({
			rules:{
				tagQuence:{
					required:true,
					maxlength: 128
				},
				companyName:{
					required:true
				},
				productCode:{
					required:true
				},
				productName:{
					required:true,
					maxlength: 28
				},
				materialSource:{
					maxlength: 28
				},
				batchNo:{
					isDigits:true,
					maxlength: 28
				},
				productCertNum:{
					maxlength: 20
				},
				dealerName:{
					maxlength: 24
				},
				productDate:{
					isDigits:true,
					minlength: 6,
        			maxlength: 6
				},
				expiredDate:{
					isDigits:true,
					minlength: 6,
        			maxlength: 6
				},
				saleTime:{
					isDigits:true,
					minlength: 6,
        			maxlength: 6
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	          /*   $.operate.save(prefix + "/edit", $('#form-tagInfo-edit').serialize()); */
	          editSave();
	        }
	    }
	
		function editSave(){
		 	$.ajax({
        		cache : true,
        		type : "POST",
        		url : prefix + "/edit",
        		data : {
        			"id" :  $("#id").val(),
        			"tagQuence" : $("#tagQuence").val(),
        			"companyName" : $("#companyName").val(),
        			"productCode" : $("#productCode").val(),
        			"productName" : $("#productName").val(),
        			"materialSource" : $("#materialSource").val(),
        			"processTech" : $("#processTech").val(),
        			"productDate" : $("#productDate").val(),
        			"batchNo" : $("#batchNo").val(),
        			"productRank" : $("#productRank").val(),
        			"expiredDate" : $("#expiredDate").val(),
        			"productCertNum" : $("#productCertNum").val(),
        			"proCheckCode" : $("#proCheckCode").val(),
        			"dealerName" : $("#dealerName").val(),
        			"saleTime" : $("#saleTime").val(),
        			"saleCheckCode" : $("#saleCheckCode").val(),
        			"readCounter" : $("#readCounter").val(),
        			"cmac" : $("#cmac").val(),
        			"updateTime" : $("#updateTime").val(),
        			"remarks" : $("#remarks").val(),
        			"oldCode" : $("#productCode1").val(),
        			"editInfo" : $("#editInfo").val(),
        		},
        		async : false,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
		}
	</script>
</body>
</html>
